<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@ include file="/common/include.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src='<s:url value="/scripts/CustomTreeUI.js" includeParams="none"/>'></script>
<link rel="stylesheet" type="text/css" href='<s:url value="/scripts/column-tree.css" includeParams="none"/>'/>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/css.css">
<script src='<s:url value="/dwr/interface/commonSearchListService.js" includeParams="none"/>' type="text/javascript"></script>

<title>主题列表</title>
<script>
var  highlightcolor='#F8EABE';
//此处clickcolor只能用win系统颜色代码才能成功,如果用#xxxxxx的代码就不行,还没搞清楚为什么:(
var  clickcolor='#fff';
function  changeto(){
source=event.srcElement;
if  (source.tagName=="TR"||source.tagName=="TABLE")
return;
while(source.tagName!="TD")
source=source.parentElement;
source=source.parentElement;
cs  =  source.children;
//alert(cs.length);
if  (cs[1].style.backgroundColor!=highlightcolor&&source.id!="nc"&&cs[1].style.backgroundColor!=clickcolor)
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor=highlightcolor;
}
}

function  changeback(){
source=event.srcElement;
if  (event.fromElement.contains(event.toElement)||source.contains(event.toElement)||source.id=="nc")
return
if  (event.toElement!=source&&cs[1].style.backgroundColor!=clickcolor)
//source.style.backgroundColor=originalcolor
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor="";
}
}

function  clickto(){
source=event.srcElement;
if  (source.tagName=="TR"||source.tagName=="TABLE")
return;
while(source.tagName!="TD")
source=source.parentElement;
source=source.parentElement;
cs  =  source.children;
//alert(cs.length);
if  (cs[1].style.backgroundColor!=clickcolor&&source.id!="nc")
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor=clickcolor;
}
else
for(i=0;i<cs.length;i++){
	cs[i].style.backgroundColor="";
}
}

	
	
	function goBack(){			
		document.getElementById("strDomainId").value = document.getElementById("qdDomain.id").value;
		document.getElementById("s_user_form").action="qdDomainSearch!doReSearch.action";	
		document.getElementById("s_user_form").submit();
	}	
	
	function doSave(){
		var cname = document.getElementById("cNameId").value;	
		if(cname==""){
			alert("条件名称不能为空，请输入！");
			return ;
		}
		
		var saveType = document.getElementById("saveType").value;		
		if(saveType=="1"){
			alert("此条件已保存,不能再进行保存操作!");
			return;
		}else{
			document.getElementById("strDomainId").value = document.getElementById("qdDomain.id").value;
			document.getElementById("s_user_form").action="qdDomainSearch!saveHisCondition.action";		
			document.getElementById("s_user_form").submit();
		}
	}
	
	
</script>
</head>
<body>
<div class="main">
<s:form id="s_user_form" namespace="/querythemes" action="qdDomainSearch!doSearch.action">
<div class="main_title"><b>你当前的位置：</b><s:property value="title" /></div>
	<s:hidden name="pageSize" id="pageSize"/>
	<s:hidden name="qdDomain.id" id="qdDomain.id"/>	
	<s:hidden name="countField" id="countField"/>
	<s:hidden name="condstrcn" id="condstrcn"/>
	<s:hidden name="condstr" id="condstr"/>
	<s:hidden name="fieldstr" id="fieldstr"/>
	<s:hidden name="orderstr" id="orderstr"/>
	<s:hidden name="ordertypestr" id="ordertypestr"/>
	<s:hidden name="searchType" id="searchType"/>
	<s:hidden name="strDomainId" id="strDomainId"/>
	<s:hidden name="saveType" id="saveType"/>
	<table  cellpadding="1" cellspacing="1" class="search">
      <tr class="listr2">
        <td align="right" style="width:25%">条件名称:</td>
        <td align="left" class="listr5">
        	<s:textfield cssClass="leaf" name="cName" id="cNameId" validate="{type:'required'}"/><font color="red">*</font>    	
        </td> 
      </tr>        
      <tr class="listr2">
        <td align="right">条件描述</td>
        <td align="left" class="listr5">
        	<s:textarea name="cDescript"></s:textarea>
        </td>               
      </tr>
    </table>
    <br>
   
   <div class="tableHeader4">
 		 <table>
 		 	<tr style="width:100%">
 		 		<td style="width:25%">
 		 			&nbsp;
 		 		</td>
 		 		<td style="width:50%">
 		 			<input name="" type="button" value="保 存" class="add" onmouseover="this.className='add_hover'" onmouseout="this.className='add'"   onclick="doSave()"/>
 		 			<input name="" type="button" value="返 回" class="back" onmouseover="this.className='back_hover'" onmouseout="this.className='back'"   onclick="goBack()"/>
 		 		</td>
 		 	</tr>
 		 </table> 
	</div>
	
    <div class="main_title"><b>已保存查询</div>
       
	<s:if test="hisConditionListSize==0">
		<table  cellpadding="1" cellspacing="1" class="search">
	      <tr class="listr2">
	        <td align="left" ><i>&nbsp;&nbsp;无</i></td>	        
	      </tr>
	    </table>
	</s:if>
	<s:if test="hisConditionListSize>0">
		<table id="res-table" cellpadding="1" cellspacing="1" class="tablelist"  onmouseover="changeto()"  onmouseout="changeback()">
		  <tr class="toptitle">
		  	<td>序号</td>
		  	<td>保存者</td>
		    <td>条件名称</td>
			<td>条件描述</td>	
			<td>操作</td>
		  </tr>
		  <tbody>
			<s:iterator value="hisConditionList" status="status">
				<s:if test="#status.even">
				 <tr class="listr1" onmouseover="this.className='listr3'" onmouseout="this.className='listr1'">
				</s:if>
				<s:else>
				 <tr class="listr2" onmouseover="this.className='listr3'" onmouseout="this.className='listr2'">
				</s:else>
					<td>&nbsp;<s:property value="#status.index+1" /></td>
					<td>&nbsp;
						<s:property value="%{top.getUserName()}"/>
					</td>
					<td>&nbsp;<s:property value="condname" /></td>	
					<td>&nbsp;<s:property value="descript" /></td>		
					<td>&nbsp;
						<s:url id="deleteUrl" namespace="/querythemes"
							action="qdDomainSearch!deleteHisConditionFromSavePage.action" includeParams="false">
							<s:param name="qdHisConditionId">
								<s:property value="id" />
							</s:param>
							<s:param name="strDomainId">
								<s:property value="qdDomain.id" />
							</s:param>	
							<s:param name="pageSize">
								<s:property value="pageSize" />
							</s:param>
							<s:param name="qdDomain.id">
								<s:property value="qdDomain.id" />
							</s:param>
							<s:param name="strSql">
								<s:property value="strSql" />
							</s:param>
							<s:param name="countField">
								<s:property value="countField" />
							</s:param>
							<s:param name="condstrcn">
								<s:property value="condstrcn" />
							</s:param>
							<s:param name="condstr">
								<s:property value="condstr" />
							</s:param>
							<s:param name="fieldstr">
								<s:property value="fieldstr" />
							</s:param>
							<s:param name="orderstr">
								<s:property value="orderstr" />
							</s:param>
							<s:param name="ordertypestr">
								<s:property value="ordertypestr" />
							</s:param>
							<s:param name="searchType">
								<s:property value="searchType" />
							</s:param>
							<s:param name="saveType">
								<s:property value="saveType" />
							</s:param>								
						</s:url>
						<s:url id="queryUrl" namespace="/querythemes"
							action="qdDomainSearch!doSearchByHisCondition.action" includeParams="false">
							<s:param name="qdHisConditionId">
								<s:property value="id" />
							</s:param>
							<s:param name="qdDomain.id">
								<s:property value="qdDomain.id" />
							</s:param>	
							<s:param name="pageSize">
								<s:property value="pageSize" />
							</s:param>					
						</s:url>
						<s:a href='%{queryUrl}'>查询</s:a>
						&nbsp; / &nbsp;
						<s:a href='%{deleteUrl}'>删除</s:a>
					</td>
				</tr>
			 </s:iterator>
		   </tbody>
		</table>
	</s:if>
		
	
 	
</s:form>
</div>
</body>
</html>